<SCRIPT type="text/javascript">
	var serversetting = {
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			//onCollapse: alert("up"),
			onExpand: function(){
				if (treeNiceScroll) {
					treeNiceScroll.resize();
				}
			}
		},
		view: {
			showLine: false
		}
	};
	

	
	var server =[
		{ id:"all", pId:0, name:"全部服务器",icon:"/assets/images/icon-file-closed.png",open:true, url:"/${orgi}/manage/serviceplan/systemstatus/all.html",target:"_self"},
		{ id:"exchange", pId:"all", name:"交互式请求渲染",icon:"/assets/images/computer-server.png", url:"/${orgi}/manage/serviceplan/systemstatus/exchange.html",target:"_self"},
		{ id:"back", pId:"all", name:"后台请求渲染",icon:"/assets/images/computer-server.png", url:"/${orgi}/manage/serviceplan/systemstatus/back.html",target:"_self"},
		{ id:"analyse", pId:"all", name:"多维数据分析（M-OLAP）",icon:"/assets/images/computer-server.png", url:"/${orgi}/manage/serviceplan/systemstatus/analyse.html",target:"_self"},
		{ id:"dispatch", pId:"all", name:"作业调度、处理 ",icon:"/assets/images/computer-server.png", url:"/${orgi}/manage/serviceplan/systemstatus/dispatch.html",target:"_self"},
		{ id:"others", pId:"all", name:"其他服务（预警、短信/邮件、文件等） ",icon:"/assets/images/computer-server.png", url:"/${orgi}/manage/serviceplan/systemstatus/others.html",target:"_self"}
	];
	
	$(document).ready(function(){
		var serverTree = $.fn.zTree.init($(document.getElementById("server_list")), serversetting, server);
		serverTree.selectNode(serverTree.getNodeByParam("id", "${type!''}", null));
		$("a.service_a").on("click",function(e){
			$(".table_style_1 tr").each(function(){
				$(this).css("background-color","#FFFFFF");
			});
			$(this).parents("tr").css("background-color","#FFE6B0");
		});
		$('.chk_service').on("click",function(){
			
		})
	});


	window.onload=window.onresize=function(){
		  resizeServicePanel();
	}
	function resizeServicePanel(){
		var winHeight = $(window).height() , winWidth = $(window).width();
		var isNotIE=-[-1,];
		if(isNotIE)
		{
			 scrollHeight = document.body.scrollHeight;//非IE浏览器
		}
		else
		{
			 scrollHeight = document.documentElement.scrollHeight;//IE浏览器
		}
		$('#filterList').height(scrollHeight - 130- 173);
		$('#right_mon_panel').height(scrollHeight - 130);

	}
	function serverGroupEdit(type,id){
		var url = "";
		if($("input[name='"+type+id+"']:checked").length>0){
			url="/{orgi}/manage/serviceplan/"+id+"/servertypeedit/import/"+type+".html";
			loadURLWithTip(url , '#tempdiv' , function(data){alertMsg(data)}, false);
		}else{
			art.confirm('您确定要移除此服务吗？' 
			, function(){
				url="/{orgi}/manage/serviceplan/"+id+"/servertypeedit/remove/"+type+".html";
				loadURLWithTip(url , '#tempdiv' , function(data){alertMsg(data)}, false);
			} 
			, function(){$("input[name='"+type+id+"']").prop("checked",true)})
			
		}
		
	}
	function serviceStatusEdit(id){
		
		var action=$("#service"+id).attr("action");
		
		art.confirm(action=="open"?'您确定要开启本服务吗？':'您确定要关闭本服务吗？' 
		, function(){
			var url = "/${orgi}/manage/serviceplan/"+id+"/serverstatusedit/"+action+"/service.html";
			loadURLWithTip(url , '#tempdiv' , function(data){
				if(data.indexOf("error")<0){
					if(action=="open"){
						$("#service"+id).attr("action","close");
						$("#service"+id).attr("title","停止服务");
						$("#service"+id).attr("class","tbControlIcon icon_stopservice");
					}else{
						$("#service"+id).attr("action","open");
						$("#service"+id).attr("title","启动服务");
						$("#service"+id).attr("class","tbControlIcon icon_startservice");
					}
				}
				alertMsg(data);
			
			}, true);
		
		} 
		, function(){})

		
	}
	function jvmStatusEdit(id){
		var action=$("#jvm"+id).attr("action");
		
		art.confirm(action=="open"?'您确定要开启本服务器吗？':'您确定要关闭本服务器吗？' 
		, function(){
			var url = "/${orgi}/manage/serviceplan/"+id+"/serverstatusedit/"+action+"/jvm.html";
			loadURLWithTip(url , '#tempdiv' , function(data){
				if(data.indexOf("error")<0){
					if(action=="open"){
						$("#jvm"+id).attr("action","close");
						$("#jvm"+id).attr("title","停止服务器");
						$("#jvm"+id).attr("class","tbControlIcon icon_stopjvm");
					}else{
						$("#jvm"+id).attr("action","open");
						$("#jvm"+id).attr("title","启动服务器");
						$("#jvm"+id).attr("class","tbControlIcon icon_startjvm");
					}
					
				}
				alertMsg(data);
			}, true);
		} 
		, function(){})
		
		
	}
	
</SCRIPT>

<div class="rs_layout_top breadCrumbWrap">
	<div class="breadCrumbStart">您当前的位置是在：</div>
	<ul class="breadCrumb">
		<li class="bc_ithems"><a href="/${orgi}/manage/task/taskpassing.html">系统管理</a></li>
		<li class="bc_ithems"><a href="/${orgi}/manage/serviceplan/systemstatus/all.html">系统服务规划</a></li>
	</ul>
	<ul class="controlButtons">
		<li class="cbtn-icon-8" data-toggle="ajax" id="serverimport" href="/${orgi}/manage/serviceplan/serverimport.html" data-width="480" title="导入服务器"></li>
	</ul>
</div>
<div class="rs_layout_left" resizable="true" style="width:230px;">
	<div class="lftTreeWrap">

		<div class="rs_layout_top" style="font-size: 12px">
			<div class="task_title2">服务器列表</div>
			<div class="ztree" id="server_list"></div>
		</div>
	</div>
</div>
<!--<div class="rs_layout_right" style="width:300px;"></div>-->
<div class="rs_layout_center" style="min-width:500px;">
	<div class="tableScrollWrap" tabindex="5000" style="overflow: hidden; outline: none;">
		<table class="table_style_1">
			<thead>
				<tr>
					<th><i class="verMidWrap">IP</i><i class="tbArrow"></i></th>
					<th><i class="verMidWrap">创建时间</i></th>
					<th align="center">状态</th>
					<th class="minSize">交互式请求渲染</th>
					<th class="minSize">后台请求渲染</th>
					<th class="minSize">多维数据分析</th>
					<th class="minSize">作业调度</th>
					<th class="minSize">其他服务</th>
					<th class="minSize">操作</th>
				</tr>
			</thead>
			<tbody>
				
				<#if clusterList??>
				<#list clusterList as server>
				<tr>
					<td><a href="/${orgi}/manage/serviceplan/serverevent/${server.id!''}.html"><i class="tbControlIcon icons_status_clusterserver"></i>${server.serverhost!''}</a></td>
					<td>${server.createtime!''}</td> 
					<td>${server.servers!''}</td> 
					<td align="center" class="chk_service"><input <#if server.exchange>checked="checked"</#if> name="exchange${server.id!''}" onclick="serverGroupEdit('exchange','${server.id!''}')" value="${server.id!''}" type="checkbox"></td>
					<td align="center" class="chk_service"><input <#if server.back>checked="checked"</#if> name="back${server.id!''}" onclick="serverGroupEdit('back','${server.id!''}')" value="${server.id!''}" type="checkbox"></td>
					<td align="center" class="chk_service"><input <#if server.analyse>checked="checked"</#if> name="analyse${server.id!''}" onclick="serverGroupEdit('analyse','${server.id!''}')" value="${server.id!''}" type="checkbox"></td>
					<td align="center" class="chk_service"><input <#if server.dispatch>checked="checked"</#if> name="dispatch${server.id!''}" onclick="serverGroupEdit('dispatch','${server.id!''}')" value="${server.id!''}" type="checkbox"></td>
					<td align="center" class="chk_service"><input <#if server.others>checked="checked"</#if> name="others${server.id!''}" onclick="serverGroupEdit('others','${server.id!''}')" value="${server.id!''}" type="checkbox"></td>
					<td class="minSize">
						<i <#if server.spare1??&&server.spare1=='0'>action="open" class="tbControlIcon icon_startservice" title="启动服务"<#else>action="close" class="tbControlIcon icon_stopservice" title="停止服务"</#if> id="service${server.id!''}" onclick="serviceStatusEdit('${server.id!''}')"></i> 
						<i <#if server.spare0??&&server.spare0=='0'>action="open" title="启动服务器" class="tbControlIcon icon_startjvm"<#else>action="close" title="停止服务器" class="tbControlIcon icon_stopjvm" </#if> id="jvm${server.id!''}" onclick="jvmStatusEdit('${server.id!''}')"></i> 
						<a onclick="art.confirm('您确定要删除此服务器吗？' , function(){location.href='/${orgi}/manage/serviceplan/serverdelo/${server.id!''}.html'} , function(){})" href="javascript:void(0)" title="删除服务器"><i class="tbControlIcon tci-18"></i></a>
					</td>
				</tr> 
				</#list>
				</#if>
			</tbody>
		</table>
	</div>  
</div>